import 'package:schoollifedemo/base/dio_network_util.dart';
import 'package:schoollifedemo/base/url_contract.dart';
import 'package:schoollifedemo/channel/channel_service.dart';
import 'package:schoollifedemo/base/application.dart';

class BaseViewModel {
  final Application _application = Application();
  final ChannelService _channelService = ChannelService();
  final NetworkUtil _networkUtil = NetworkUtil();

  void init({
    String baseUrl = UrlContract.baseAddress,
    int connectTimeout = 100,
    int receiveTimeout = 100,
  }) {
    _application.init();
    _channelService.init();
    _networkUtil.init(
      baseUrl: baseUrl,
      connectTimeout: connectTimeout,
      receiveTimeout: receiveTimeout,
    );
  }

  Application getApplication() => _application;

  ChannelService getChannelService() => _channelService;

  NetworkUtil getNetworkUtil() => _networkUtil;

  void dispose() {
    //application.dispose();
    //channelService.dispose();
    _networkUtil.dispose();
  }
}
